<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 5.2.4 or newer
 *
 * NOTICE OF LICENSE
 *
 * Licensed under the Open Software License version 3.0
 *
 * This source file is subject to the Open Software License (OSL 3.0) that is
 * bundled with this package in the files license.txt / license.rst.  It is
 * also available through the world wide web at this URL:
 * http://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to obtain it
 * through the world wide web, please send an email to
 * licensing@ellislab.com so we can send you a copy immediately.
 *
 * @package		CodeIgniter
 * @author		EllisLab Dev Team
 * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
 * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */

/**
 * Input Class
 *
 * Pre-processes global input data for security
 *
 * @package		CodeIgniter
 * @subpackage	Libraries
 * @category	Input
 * @author		EllisLab Dev Team
 * @link		http://codeigniter.com/user_guide/libraries/input.html
 */
class MY_Input extends CI_Input {

    /**
     * Constructor
     *
     * Sets whether to globally enable the XSS processing
     * and whether to allow the $_GET array
     *
     * @return	void
     */
    public function __construct() {
        parent::__construct();
        log_message('debug', 'MY_Input Class Initialized');
    }

    // --------------------------------------------------------------------

    /**
     * Fetch an item from the GET array
     *
     * @param	string
     * @param	bool
     * @return	string
     */
    public function get($index = NULL, $xss_clean = FALSE) {
        if ($index === NULL && !empty($_GET)) {
            log_message('input', '_GET -> ' . json_encode($_GET));
        } else if (!empty($_GET)) {
            log_message('input', '_GET -> KEY: ' . $index . ' VALUE: ' . json_encode(!isset($_GET[$index]) ? '' : $_GET[$index]));
        }
        return parent::get($index, $xss_clean);
    }

    // --------------------------------------------------------------------

    /**
     * Fetch an item from the POST array
     *
     * @param	string
     * @param	bool
     * @return	string
     */
    public function post($index = NULL, $xss_clean = FALSE) {
        if ($index === NULL && !empty($_POST)) {
            log_message('input', '_POST -> ' . json_encode($_POST));
        } else if (!empty($_POST)) {
            log_message('input', '_POST -> KEY: ' . $index . ' VALUE: ' . json_encode(!isset($_POST[$index]) ? '' : $_POST[$index]));
        }
        return parent::post($index, $xss_clean);
    }

}

/* End of file Input.php */
/* Location: ./system/core/Input.php */
